import express from 'express'

import logger from './utils/logger'

import router from './router/index'

import config from './config/default'

import initMiddleware from './middleware'

const app = express()

initMiddleware(app)

app.use(express.json())

const PORT = config.port

// 启动监听
app.listen(PORT, async () => {
    logger.info(`Express App is running at http://localhost:${PORT}`)
    router(app)
})